import { Entity, Column, PrimaryGeneratedColumn, UpdateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
import { ApiProperty} from '@nestjs/swagger';
import { IsOptional, IsDefined } from 'class-validator';

@Entity()
export class Cart {
  @PrimaryGeneratedColumn({type: 'mediumint'})
  id: number;

  @Column({type: 'mediumint'})
  user_id:number;

  @Column({type: 'char' ,length: 32 })
  session_id: string;

  @Column({type: 'mediumint'})
  goods_id:number;

  @Column({type: 'varchar', length: 60})
  goods_sn:string;

  @IsOptional()
  @IsDefined()
  @ApiProperty()
  @Column({type: 'mediumint'})
  product_id:number;

  @Column({type: 'varchar' ,length: 120 })
  goods_name: string;

  @Column({type: 'decimal', width: 10, precision: 2})
  market_price:number;

  @Column({type: 'decimal', width: 10, precision: 2})
  retail_price:number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'smallint'})
  number:number;

  @Column({type: 'text'})
  goods_specifition_name_value: string;

  @Column({type: 'varchar', length: 60})
  goods_specifition_ids: string;

  @Column({type: 'tinyint'})
  checked:number;

  @Column({type: 'varchar', length: 255})
  list_pic_url: string;
}
